<!-- 任务分页组件 -->
<script setup lang="ts">
const props = defineProps<{
  total: number;
  currentPage: number;
  pageSize: number;
}>();

const emit = defineEmits<{
  'update:currentPage': [value: number];
  'update:pageSize': [value: number];
  pagination: [];
}>();

/** 分页变化处理 */
function handlePagination() {
  emit('pagination');
}

/** 页码变化处理 */
function handleCurrentPageChange(page: number) {
  emit('update:currentPage', page);
}

/** 页面大小变化处理 */
function handlePageSizeChange(size: number) {
  emit('update:pageSize', size);
}
</script>

<template>
  <div v-if="total > 0" class="pagination-container">
    <pagination
      :total="total"
      :page="currentPage"
      :limit="pageSize"
      @pagination="handlePagination"
      @update:page="handleCurrentPageChange"
      @update:limit="handlePageSizeChange"
    />
  </div>
</template>

<style scoped>
.pagination-container {
  padding: 20px;
  text-align: center;
}
</style>
